# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AppsActivity.V1.Model.Permission do
  @moduledoc """
  Contains information about the permissions and type of access allowed with regards to a Google Drive object. This is a subset of the fields contained in a corresponding Drive Permissions object.

  ## Attributes

  *   `name` (*type:* `String.t`, *default:* `nil`) - The name of the user or group the permission applies to.
  *   `permissionId` (*type:* `String.t`, *default:* `nil`) - The ID for this permission. Corresponds to the Drive API's permission ID returned as part of the Drive Permissions resource.
  *   `role` (*type:* `String.t`, *default:* `nil`) - Indicates the Google Drive permissions role. The role determines a user's ability to read, write, or comment on the file.
  *   `type` (*type:* `String.t`, *default:* `nil`) - Indicates how widely permissions are granted.
  *   `user` (*type:* `GoogleApi.AppsActivity.V1.Model.User.t`, *default:* `nil`) - The user's information if the type is USER.
  *   `withLink` (*type:* `boolean()`, *default:* `nil`) - Whether the permission requires a link to the file.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :name => String.t(),
          :permissionId => String.t(),
          :role => String.t(),
          :type => String.t(),
          :user => GoogleApi.AppsActivity.V1.Model.User.t(),
          :withLink => boolean()
        }

  field(:name)
  field(:permissionId)
  field(:role)
  field(:type)
  field(:user, as: GoogleApi.AppsActivity.V1.Model.User)
  field(:withLink)
end

defimpl Poison.Decoder, for: GoogleApi.AppsActivity.V1.Model.Permission do
  def decode(value, options) do
    GoogleApi.AppsActivity.V1.Model.Permission.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AppsActivity.V1.Model.Permission do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
